<?php
//Класс обеспечивает работу с view, в том числе передачу данных во вложенные view
class View {
    private $data;
    private $view_name;
    function __construct($view_name, $data) {
        $this->data = $data;
		$this->view_name = $view_name;        
    }
    
    function load($view_name = FALSE) {
        if (!$view_name)
          $view_name = $this->view_name;
        extract($this->data);
        $view = $this;
        require_once(Path::view($view_name));
    }
	
	function head() {
		extract($this->data['head']);
		require_once(Path::system_view('head'));
	}
	
	function block($block_name) {
		if ($this->data['_blocks'][$block_name])
		    extract($this->data['_blocks'][$block_name]);
		require_once(Path::block($block_name));
	}
	
	function header() {
		if ($this->data['header'])
		  extract($this->data['header']);
        require_once(Path::view('header'));
	}
	
	function footer() {
		if ($this->data['footer'])
		  extract($this->data['footer']);
        require_once(Path::view('footer'));
	}
}

?>